package com.publishproject.test;

import android.graphics.Color;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;

import com.materialcalendarview.CalendarMode;
import com.materialcalendarview.MaterialCalendarView;
import com.publishproject.R;

import java.util.Date;
import java.util.Random;

public class MaterialCalendarViewActivity extends AppCompatActivity {

    private MaterialCalendarView calendar;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_material_calendar_view);
        calendar = (MaterialCalendarView)findViewById(R.id.calendar);
        calendar.setDateSelected(new Date(),true);
        calendar.setFirstDayOfWeek(1);
        calendar.setCalendarDisplayMode(CalendarMode.MONTHS);
        calendar.setCurrentDate(new Date());
        calendar.setSelectionRadius(30);
    }
    public void change(View view){
        calendar.setSelectionColor(Color.parseColor(generate()));
    }
    public String generate(){
        String [] args = {"0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"};
        String t = "#";
        for(int i = 0;i < 6;i++){
            t+=args[new Random().nextInt(16)];
        };
        return t;
    }
}
